package com.huiquan.vocab.dao;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.analysis.domain.User;
import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.vocab.domain.VocabElementReasonClassSexAge;
import com.ibatis.sqlmap.client.SqlMapClient;

/**
 * 原因词分类 Dao
 *
 * @author leo
 * @time 2017年7月19日 下午4:32:52
 */
@Repository
public class VocabElementReasonClassSexAgeDao extends EnhancedBaseDao<VocabElementReasonClassSexAge> {
	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "VOCAB_ELEMENT_REASON_CLASS_SEX_AGE.";

	public VocabElementReasonClassSexAgeDao() {
		super(space);
	}

	public void setSex(String id, String sex, User user) {
		Map<String, Object> param = new HashMap<>();
		param.put("id", id);
		param.put("sex", sex);

		this.update(space + "SET_SEX", param, sqlMapClient);
	}

	public void setAge(String id, String age, User user) {
		Map<String, Object> param = new HashMap<>();
		param.put("id", id);
		param.put("age", age);

		this.update(space + "SET_AGE", param, sqlMapClient);
	}

	public void submitSexAge(String ids, User user) {
		Map<String, Object> param = new HashMap<>();
		param.put("ids", "(" + ids + ")");

		this.update(space + "SUBMIT_SEX_AGE", param, sqlMapClient);
	}

	public void init() {
		this.update(space + "INIT", sqlMapClient);
	}

}
